<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>系统首页</title>
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/jquery-easyui-1.8.8/themes/gray/easyui.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/jquery-easyui-1.8.8/themes/icon.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/jquery-easyui-1.8.8/themes/color.css">
<script type="text/javascript"
	src="${pageContext.request.contextPath}/jquery-easyui-1.8.8/jquery.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/jquery-easyui-1.8.8/jquery.easyui.min.js"></script>

</head>
<body class="easyui-layout" >
	<div id="cc" class="easyui-layout"
		style="width: 100%; heith: 100%; min-height: 600px;">
		<div data-options="region:'north',border:false" style="height: 80px;">
			<img alt="logo" src="../images/login_1.png"
				style="width: 300px;padding: 20px 0 0 20px;">
			<div style="float:right;padding-top: 3%;padding-right: 50px;font-size: 16px;">欢迎您，${sessionScope.SESSION_USER}</div>
		</div>
		<div data-options="region:'west',title:'菜单',split:true"
			style="width: 200px;">
			<div id="aa" class="easyui-accordion"
				data-options="fit:true,border:false">

				<div title="个人信息" data-options="iconCls:'icon-save',selected:true"
					style="overflow: auto; padding: 10px;">

					<a id="btn" href="javascript:void(0);" class="easyui-linkbutton"
						data-options="plain:true"
						onclick="open_menu('个人信息','${pageContext.request.contextPath}/teacher/info')">个人信息</a>
				</div>

				<div title="我的班级" data-options="iconCls:'icon-save',selected:true"
					style="overflow: auto; padding: 10px;">
					<a id="btn" href="javascript:void(0);" class="easyui-linkbutton"
						data-options="plain:true"
						onclick="open_menu('班级成员','${pageContext.request.contextPath}/orderList/index')">班级成员</a><br>
					<a id="btn" href="javascript:void(0);" class="easyui-linkbutton"
						data-options="plain:true"
						onclick="open_menu('作业发布','${pageContext.request.contextPath}/homeworkteacher/index')">作业发布</a><br>
					<a id="btn" href="javascript:void(0);" class="easyui-linkbutton"
						data-options="plain:true"
						onclick="open_menu('考试发布','${pageContext.request.contextPath}/orderList/index')">考试发布</a><br>
					<a id="btn" href="javascript:void(0);" class="easyui-linkbutton"
						data-options="plain:true"
						onclick="open_menu('审批假条','${pageContext.request.contextPath}/outrequestteacher/index')">审批假条</a><br>
					<a id="btn" href="javascript:void(0);" class="easyui-linkbutton"
						data-options="plain:true"
						onclick="open_menu('学生成绩','${pageContext.request.contextPath}/admin/score')">学生成绩</a><br>
					<a id="btn" href="javascript:void(0);" class="easyui-linkbutton"
						data-options="plain:true"
						onclick="open_menu('学习报告','${pageContext.request.contextPath}/admin/report')">学习报告</a><br>
					<a id="btn" href="javascript:void(0);" class="easyui-linkbutton"
						data-options="plain:true"
						onclick="open_menu('教室信息','${pageContext.request.contextPath}/admin/classroom')">教室信息</a>
				</div>

				<div title="系统管理" data-options="iconCls:'icon-reload'"
					style="padding: 10px;">
					<a id="passEdit" href="javascript:void(0);" class="easyui-linkbutton" 
						data-options="plain:true">修改密码</a> <br> <a
						href="javascript:void(0);" class="easyui-linkbutton"
						data-options="plain:true">刷新系统缓存</a> <br> <a
						href="${pageContext.request.contextPath}/user/logout"
						class="easyui-linkbutton" data-options="plain:true">退出系统</a>
				</div>

			</div>
		</div>
		<div id="win" class="easyui-dialog" style="width:300px;height:300px;" data-options="title:'修改密码',buttons:'#bb',modal:true">
		   <form id="passEdit_fm" method="post">
		    	<table>
					<tbody>
						<tr>
							<td><input name="name" type="hidden" value="${sessionScope.SESSION_USER}" ></td>
						</tr>
						<tr>
							<td>旧密码:</td>
							<td><input name="password" type="password" class="easyui-validatebox" 
							 data-options="required:true, missingMessage:'请输入原密码'"></td>
						</tr>
						<tr>
							<td>新密码:</td>
							<td><input id="newPassword" name="newPassword" type="password" class="easyui-validatebox" 
							 data-options="required:true, missingMessage:'请输入新密码'"></td>
						</tr>
						<tr>
							<td>确认密码:</td>
							<td><input id="ackPassword" name="ackPassword" type="password" class="easyui-validatebox" 
							 data-options="required:true, missingMessage:'请确认新密码'"></td>
						</tr>
					</tbody>
		    	</table>
	    	</form>
		</div>
		<div id="bb">
		    <a href="#" onclick="javascript:return passEdit()" class="easyui-linkbutton">保存</a>
		    <a id="closeEdit" href="#" class="easyui-linkbutton">关闭</a>
		</div>

		<div data-options="region:'center',border:false,plain:true">
			<div id="tt" class="easyui-tabs" fit=true>
				<div title="首页" style="text-align: center; font-size: 24px;">
					<p>欢迎来到学生信息管理系统</p>
				</div>
			</div>
		</div>
	</div>
	<div style="height: 40px; text-align: center; font-size: 12px;">
	   <p>版权所有,&copy;2019-2020</p>
	</div>


	<script type="text/javascript">

	   $(function(){
			$('#win').window('close');
		})

		function open_menu(titleName, menuUrl) {
			if ($("#tt").tabs("exists", titleName)) {
				$("#tt").tabs("select", titleName);
			} else {
				$('#tt').tabs('add', {
					title : titleName,
					href : menuUrl,
					closable : true
				});
			}
		}
	   function passEdit() {
			var newPassword = $('#newPassword').val();
			var ackPassword = $('#ackPassword').val();

			$('#passEdit_fm').form('submit', {
				url : "${pageContext.request.contextPath}/teacher/passEdit",
				onSubmit : function() {
					if(newPassword != ackPassword){
						$.messager.show({
							title : 'Error',
							msg : '确认密码错误！'
						});
						return false;
					}
					return $(this).form('validate');
				},
				success : function(result) {
					var result = eval('(' + result + ')');
					if (!result.success) {
						$.messager.show({
							title : 'Error',
							msg : result.errorMsg
						});
					} else {
						$('#passEdit_fm')[0].reset();
						$('#win').window('close');
						$.messager.show({
							title : 'Info',
							msg : result.errorMsg
						});
					}
				}
			});
		}
		$('#passEdit').click(function(){
			$('#passEdit_fm')[0].reset();
			$('#win').window('open');
		});
		$('#closeEdit').click(function(){
			$('#passEdit_fm')[0].reset();
			$('#win').window('close');
		});
		
	</script>

</body>
</html>